package com.chong.foundation;

public class Calculation03 {
    public static void main(String[] args) {
        //3.比较运算符 比较运算返回的结果是一个boolean值不是true就是false;
        //> < ！=  >= <=
        int a = 10;
        int b = 20;

        System.out.println(a > b);//false
        System.out.println(a < b);//true
        System.out.println(a != b);//true
        System.out.println(a >= b);//false
        System.out.println(a <= b);//true
        System.out.println("*******************");

        //4.逻辑运算符
        int c = 10;
        int d = 10;
        int e = 21;
        int f = 30;
        //与&& :两个表达式同时为true时返回true，否则返回false
        System.out.println(c == d && e == f); //true
        //或|| :有一个表达式为true时返回true，两个表达式都为false返回false
        System.out.println(c == d || e == f);//false
        //非(!)
        boolean g = true;
        System.out.println(!g); //false

        //位运算
        /*
        A=0011 1100
        B=0000 1101

        A&B=0000 1100
        A/B=0011 1101
        A^B=0011 0001
        ~B=1111 0010
         */

        // >> /2  << *2
        int nums = 2;
        System.out.println(nums << 3); //16


        //三元运算
        int a1 = 10;
        int a2 = 20;
        System.out.println(a1 > a2 ? "aaa" : "bbb"); //bbb

        //字符串操作
        int c1 = 10;
        int c2 = 20;
        System.out.println("" + c1 + c2); // 10 20
        System.out.println(c1 + c2 + ""); //30

    }
}
